home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / include / quad.h < prev    next >
C/C++ Source or Header  |  1991-03-18  |  2KB  |  70 lines

  1. /*
  2.  * quad.h --
  3.  *
  4.  *    Operations on 64-bit integers.
  5.  *
  6.  * Copyright 1991 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that this copyright
  10.  * notice appears in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/lib/include/RCS/quad.h,v 1.1 91/03/17 22:38:11 kupfer Exp $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _QUAD
  19. #define _QUAD
  20.  
  21. #include <stdio.h>
  22. #include <sys/types.h>
  23.  
  24. /* 
  25.  * For the sake of compatibility, use the BSD definition of the 
  26.  * types (i.e., use an array, rather than longs named "hi" and "lo"), 
  27.  * and get them out of the standard place (types.h).
  28.  * 
  29.  * For the sake of simplicity, always treat word 0 as the least 
  30.  * significant of the pair (though it might be better to pay attention 
  31.  * to the byte order of the machine).
  32.  */
  33.  
  34. #define QUAD_MOST_SIG    1
  35. #define QUAD_LEAST_SIG    0
  36.  
  37.  
  38. /*
  39.  *----------------------------------------------------------------------
  40.  *
  41.  * Quad_EQ --
  42.  *
  43.  *    Tell whether two quads (or unsigned quads) are equal.
  44.  *
  45.  * Results:
  46.  *    Returns non-zero if the given values are the same.
  47.  *
  48.  * Side effects:
  49.  *    None.
  50.  *
  51.  *----------------------------------------------------------------------
  52.  */
  53.  
  54. #define Quad_EQ(q1, q2) \
  55.     ((q1).val[QUAD_LEAST_SIG] == (q2).val[QUAD_LEAST_SIG] \
  56.      && (q1).val[QUAD_MOST_SIG] == (q2).val[QUAD_MOST_SIG])
  57.  
  58.  
  59.  
  60. extern void    Quad_AddUns _ARGS_ ((u_quad uq1, u_quad uq2, 
  61.                      u_quad *resultPtr));
  62. extern void    Quad_AddUnsLong _ARGS_ ((u_quad quadVal, u_long longVal,
  63.                      u_quad *resultPtr));
  64. extern int    Quad_CompareUns _ARGS_ ((_CONST u_quad *uq1,
  65.                      _CONST u_quad *uq2));
  66. extern void    Quad_PutUns _ARGS_ ((FILE *s, u_quad q));
  67. extern double    Quad_UnsToDouble _ARGS_  ((u_quad));
  68.  
  69. #endif /* _QUAD */
  70.